<script setup lang='ts'>

import { getCareOrderListByCoTypeAPI } from '@/services/docter/checkOrder'
import { ref } from 'vue'
import type { CareOrder } from '@/types/docter/careOrder'
import { onLoad } from '@dcloudio/uni-app'

const careOrderList = ref<CareOrder[]>()
const getCareOrderList = async () => {
  const res = await getCareOrderListByCoTypeAPI()
  careOrderList.value = res.data
}

onLoad(() => {
  getCareOrderList()
})

</script>

<template>
  <uni-collapse accordion>
    <uni-collapse-item v-for='item in careOrderList' :key='item.coId' :border='false' :show-arrow='false'>
      <template v-slot:title>
        <uni-card>
          <view class='itemTitle'>
            <view class='left'>
              <view class='coId'>订单号{{ item.coId }}</view>
              <view>创建时间：{{ item.createTime }}</view>
              <view>主治医生：{{ item.createBy }}</view>
            </view>
            <!--            <view class='right'>-->
            <!--              <text v-if='item.checkStatus==0'>待付款</text>-->
            <!--              <text v-if='item.checkStatus==1'>已付款</text>-->
            <!--              <text v-if='item.checkStatus==2'>已退费</text>-->
            <!--              <text v-if='item.checkStatus==3'>检测中</text>-->
            <!--              <text v-if='item.checkStatus==4'>检测完成</text>-->
            <!--            </view>-->
          </view>
        </uni-card>
      </template>
      <navigator :url='`/pagesMember/checkOrder/checkDetails?itemId=${items.itemId}`' class='content'
                 v-for='(items,index) in item?.careOrderItems' :key='items?.itemId'>
        <view style='display: flex'>
          <view>
            <text class='green'>【检查处方】</text>
            <text>【{{ index + 1 }}】</text>
            <text>【处方总额】￥{{ items.amount }}</text>
          </view>
          <view style='margin-left: 50rpx;color: #ffb32c;font-weight: bolder;font-size: 30rpx'>
            {{ items.status === '0' ? '检测中' : '检查完成' }}
          </view>
        </view>
        <view class='contentItem'>
          <view>检查项目：{{ items.itemName }}</view>
          <view>备注信息：{{ items.remark }}</view>
          <view>项目价格：{{ items.price }}</view>
          <view>检查次数：{{ items.num }}</view>
        </view>
      </navigator>
    </uni-collapse-item>
  </uni-collapse>
</template>


<style scoped lang='scss'>
.itemTitle {
  display: flex;
  align-items: center;

  .left {
    flex: 1110%;

    .coId {
      color: black;
      font-weight: bold;
      font-size: 30rpx;
    }

    view {
      margin: 5rpx 0;
      font-size: 26rpx;
      color: #999999;
    }
  }

  .right {
    flex: 110%;
  }
}

.content {
  padding: 20rpx;

  .contentItem {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;

    > view {
      width: 48%;
      padding: 5rpx 0;
      color: #999;
    }
  }

  view {
    .green {
      color: #00bf9c;
    }
  }
}
</style>
